package com.nuc.thread.status;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;

/**
 * @Description
 * @Author 诗酒趁年华
 * @Version V1.0.0
 * @Date 2021/5/5
 */
@Slf4j
public class SleepTest2 {
    public static void main(String[] args) {
        Thread thread = new Thread("t1"){
            @Override
            public void run() {
                log.debug("running");
                try {
                    TimeUnit.SECONDS.sleep(1);//睡眠一秒
                    Thread.sleep(2000);//子线程Sleep2秒
                } catch (InterruptedException e) {
                    log.error(e.getMessage());
                    e.printStackTrace();
                }
            }
        };
        thread.start();
        thread.interrupt();
    }
}
